package simple

func findLucky(arr []int) int {

	dic := make(map[int]int, len(arr))
	for i := 0; i < len(arr); i++ {
		dic[arr[i]]++
	}

	ret := -1
	for k, v := range dic {
		if k == v && ret < k {
			ret = k
		}
	}

	return ret
}
